MOHAA scripting language, Appendix B
Classes, and how they are used
To effectively use commands, it is vital to know that the commands
are sent to objects. These objects are made from a class. Classes
dictate what commands can be sent to objects that are made from
that class. This document explains all you need to know about classes
to perform advanced scripting. Many mappers will probably do just
fine by copying others scripts and modifying them, but when you
want to do some serious scripting from scratch: You need to know
about the classes of MOH. For a complete ( but short ) definition
of ALL classes, see the file g_allclasses.html ( for Allied Assault ) and MOH_GameClasses.html ( for Spearhead ).
Table of contents
Classes ( badly ) explained
All commands are sent to an object that is of a specific class.
As an example: all player objects are of the class Player
and all script_object's are of the class ScriptSlave. All
the classes are listed in the file g_allclasses.html ( for Allied Assault ) or MOH_GameClasses.html ( for Spearhead ).
Classes exist in an inheritance relationship. This works like this:
Lets use the Player class as an example:
Player -> Sentient -> Animate -> Entity -> SimpleEntity
-> Listener -> Class
This is the inheritance chain for the Player class. So? What about
it? Well this means a lot of things, but the only thing you need
to know is that the '->' arrow is interpreted as Player inherits
from Sentient. So? Inherits what? Its commands! This means that
all the commands from the classes it inherits from also work for
the inheriting classes. This also means that via this inheritance
chain, Player also inherits all commands from Class, Listener, SimpleEntity,
Entity, Animate and Sentient. So remember when reading the g_allclasses.html or MOH_GameClasses.html files: a class supports all
the commands stated PLUS all the commands stated for the classes
it inherits from ( this adds up to a lot of commands ).
The MOH class hierarchy
Here is the complete class inheritance chain for Medal of Honor:
Classes with a '*' after them, are only found in Medal of Honor
: Spearhead
It is read like this: A VehicleTurretGun is a TurretGun ( inherits
all commands from TurretGun ), a TurretGun is a Weapon, a Weapon
is an Item, an Item is a Trigger, a Trigger is an Animate, an Animate
is an Entity, an Entity is a SimpleEntity, a SimpleEntity is a Listener,
a Listener is a Class... and here's the cool thing: a VehicleTurretGun
is ( because of inheritance ) a Class ( and all things between VehicleTurretGun
and Class as well ).
|